package android.team.app.ui.missatoll;

import android.os.Bundle;
import android.team.app.R;
import android.team.app.ui.BaseActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.ImageButton;
import android.widget.Spinner;

public class TripInformationActivity extends BaseActivity{
	private Spinner spRoad, spEntry, spExit;
	private ImageButton btAdd, btNext;
	private String road, entry, exit;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.trip_information_activity);
		loadUI();
		titleHeader.setText(getString(R.string.trip_information));
		loadSpecialUI();
	}
	private void loadSpecialUI() {
		spRoad=(Spinner)findViewById(R.id.spRoad);
		spRoad.setAdapter(new ArrayAdapter<String>(baseActivity, 
				android.R.layout.simple_spinner_item, 
				getResources().getStringArray(R.array.roads)));
		
		spRoad.setOnItemSelectedListener(new OnItemSelectedListener() {

			@Override
			public void onItemSelected(AdapterView<?> parent, View view,
					int pos, long id) {
				road=parent.getItemAtPosition(pos).toString();
				
			}

			@Override
			public void onNothingSelected(AdapterView<?> parent) {
				road="10";
				
			}
		});
		
		
		
		spEntry=(Spinner)findViewById(R.id.spEntry);
		spEntry.setAdapter(new ArrayAdapter<String>(baseActivity, 
				android.R.layout.simple_spinner_item, 
				getResources().getStringArray(R.array.entry)));
		
		spEntry.setOnItemSelectedListener(new OnItemSelectedListener() {

			@Override
			public void onItemSelected(AdapterView<?> parent, View view,
					int pos, long id) {
				entry=parent.getItemAtPosition(pos).toString();
				
			}

			@Override
			public void onNothingSelected(AdapterView<?> parent) {
				entry="Giai Phong";
				
			}
		});
		
		spExit=(Spinner)findViewById(R.id.spExit);
		spExit.setAdapter(new ArrayAdapter<String>(baseActivity, 
				android.R.layout.simple_spinner_item, 
				getResources().getStringArray(R.array.exit)));
		
		spExit.setOnItemSelectedListener(new OnItemSelectedListener() {

			@Override
			public void onItemSelected(AdapterView<?> parent, View view,
					int pos, long id) {
				exit=parent.getItemAtPosition(pos).toString();
				
			}

			@Override
			public void onNothingSelected(AdapterView<?> parent) {
				exit="Giai Phong";
				
			}
		});
		
		
		btAdd=(ImageButton)findViewById(R.id.btAdd);
		
		btNext=(ImageButton)findViewById(R.id.btNext);
	}
}
